use of com.ramussoft.common.Element in project ramus by Vitaliy-Yakovchuk.
the class HTTPParser method printReportsList.
/**
* Друкує список звітів з посиланнями на них.
*
* @throws IOException
*/
protected void printReportsList() throws IOException {
Engine engine = dataPlugin.getEngine();
Qualifier qualifier = ReportPlugin.getReportsQualifier(engine);
Attribute name = ReportPlugin.getReportNameAttribute(engine);
RowSet rowSet = new RowSet(engine, qualifier, new Attribute[] { name }, null, true);
List<Element> reports = ((ReportQuery) engine).getHTMLReports();
if (reports.size() == 0)
return;
printMainTableTitle(RES.getString("reportsTitle"));
for (com.ramussoft.database.common.Row element : rowSet.getAllRows()) {
htmlStream.println("<tr>");
htmlStream.println("<td colspan=2>");
printStartATeg("reportsq/index.html?num=" + element.getElementId());
htmlStream.println(element.getCode());
printEndATeg();
printStartATeg("reportsq/index.html?num=" + element.getElementId());
htmlStream.print(element.getName());
printEndATeg();
htmlStream.println("</td>");
htmlStream.println("</tr>");
}
}
use of com.ramussoft.common.Element in project ramus by Vitaliy-Yakovchuk.
the class HTTPParser method printRowBase.
private void printRowBase(final Row row) throws IOException {
htmlStream.print("<canter><h2 class=\"Ramus\">");
if (row instanceof Function)
htmlStream.print(MovingFunction.getIDEF0Kod((com.ramussoft.database.common.Row) row) + " " + row.getName());
else
htmlStream.print(row.getKod() + ". " + row.getName());
if (row.isElement()) {
Element element = StandardAttributesPlugin.getElement(dataPlugin.getEngine(), row.getElement().getQualifierId());
if (element != null) {
htmlStream.print(" [");
printStartATeg("rows/index.html?id=" + element.getId());
htmlStream.print(element.getName());
printEndATeg();
htmlStream.print("]");
}
}
htmlStream.println("</h2></canter>");
}
use of com.ramussoft.common.Element in project ramus by Vitaliy-Yakovchuk.
the class AnyToAnyPlugin method getElementName.
private String getElementName(final IEngine engine, final HashMap<Long, Attribute> attributesCache, final HashMap<Long, Qualifier> qualifiersCache, ResultSet rs) throws SQLException {
Element element = engine.getElement(rs.getLong("element_id"));
if (element == null)
return "";
Qualifier qualifier;
if (!qualifiersCache.containsKey(element.getQualifierId())) {
qualifier = engine.getQualifier(element.getQualifierId());
qualifiersCache.put(element.getQualifierId(), qualifier);
} else
qualifier = qualifiersCache.get(element.getQualifierId());
if (qualifier == null || qualifier.getAttributeForName() < 0l)
return "";
Attribute attribute;
if (!attributesCache.containsKey(qualifier.getAttributeForName())) {
attribute = engine.getAttribute(qualifier.getAttributeForName());
attributesCache.put(qualifier.getAttributeForName(), attribute);
} else
attribute = attributesCache.get(qualifier.getAttributeForName());
if (attribute == null)
return "";
List<Persistent>[] bAttribute = engine.getBinaryAttribute(element.getId(), attribute.getId());
if (bAttribute.length == 0)
return "";
List<Persistent> list = bAttribute[0];
if (list.size() == 0)
return "";
if (list.get(0) instanceof TextPersistent)
return String.valueOf(((TextPersistent) list.get(0)).getValue());
else if (list.get(0) instanceof DFDSName)
return String.valueOf(((DFDSName) list.get(0)).getShortName());
return "";
}
use of com.ramussoft.common.Element in project ramus by Vitaliy-Yakovchuk.
the class JournaledEngine method setElementQualifier.
@Override
public void setElementQualifier(long elementId, long qualifierId) {
qualifirsForElements.remove(elementId);
Element element = getElement(elementId);
Qualifier current = getQualifier(element.getQualifierId());
Qualifier newQualifier = getQualifier(qualifierId);
final List<Attribute> attrs = new ArrayList<Attribute>();
addNotPresentAttributes(current.getAttributes(), newQualifier.getAttributes(), attrs);
addNotPresentAttributes(current.getSystemAttributes(), newQualifier.getSystemAttributes(), attrs);
Transaction[] data = getAttributesWhatWillBeDeleted(elementId, attrs);
ElementEvent event = new ElementEvent(this, element, new Element(element.getId(), qualifierId, element.getName()), element.getQualifierId());
beforeElementDeleted(event);
deligate.setElementQualifier(elementId, qualifierId);
synchronized (swithJournalLock) {
journal.store(new SetElementQualifierCommand(this, element.getQualifierId(), qualifierId, elementId, data));
}
elementDeleted(event);
event = new ElementEvent(this, element, new Element(element.getId(), qualifierId, element.getName()), qualifierId);
qualifirsForElements.remove(element.getId());
elementCreated(event);
}
use of com.ramussoft.common.Element in project ramus by Vitaliy-Yakovchuk.
the class JournaledEngine method updateElementNames.
public void updateElementNames(Qualifier old, Qualifier qualifier) {
if (qualifier == null)
return;
if ((old == null) || (old.getAttributeForName() != qualifier.getAttributeForName())) {
Attribute attr = getAttribute(qualifier.getAttributeForName());
if (attr != null) {
List<Attribute> list = new ArrayList<Attribute>(1);
list.add(attr);
Hashtable<Element, Object[]> hash = getElements(qualifier, list);
List<Element> elements = new ArrayList<Element>(hash.size());
for (Entry<Element, Object[]> entry : hash.entrySet()) {
Element element = entry.getKey();
if (entry.getValue()[0] == null) {
element.setName("");
} else {
element.setName(entry.getValue()[0].toString());
}
elements.add(element);
}
} else {
List<Element> list = getElements(qualifier.getId());
for (Element e : list) {
e.setName("");
}
}
}
}
Aggregations