use of com.runwaysdk.dataaccess.MdBusinessDAOIF in project geoprism-registry by terraframe.
the class ClearTileCache method doIt.
@Transaction
private void doIt() {
MdBusinessDAOIF mdBusiness = MdBusinessDAO.getMdBusinessDAO(TileCache.CLASS);
mdBusiness.getBusinessDAO().deleteAllRecords();
}
use of com.runwaysdk.dataaccess.MdBusinessDAOIF in project geoprism-registry by terraframe.
the class GeoObjectImporter method setTermValue.
protected void setTermValue(ServerGeoObjectIF entity, AttributeType attributeType, String attributeName, Object value, Date startDate, Date endDate) {
if (!this.configuration.isExclusion(attributeName, value.toString())) {
try {
ServerGeoObjectType type = this.configuration.getType();
MdBusinessDAOIF mdBusiness = type.getMdBusinessDAO();
MdAttributeTermDAOIF mdAttribute = (MdAttributeTermDAOIF) mdBusiness.definesAttribute(attributeName);
if (mdAttribute == null && type.getSuperType() != null) {
mdAttribute = (MdAttributeTermDAOIF) type.getSuperType().getMdBusinessDAO().definesAttribute(attributeName);
}
Classifier classifier = Classifier.findMatchingTerm(value.toString().trim(), mdAttribute);
if (classifier == null) {
Term rootTerm = ((AttributeTermType) attributeType).getRootTerm();
TermReferenceProblem trp = new TermReferenceProblem(value.toString(), rootTerm.getCode(), mdAttribute.getOid(), attributeName, attributeType.getLabel().getValue());
trp.addAffectedRowNumber(this.progressListener.getWorkProgress() + 1);
trp.setHistoryId(this.configuration.getHistoryId());
this.progressListener.addReferenceProblem(trp);
} else {
entity.setValue(attributeName, classifier.getOid(), startDate, endDate);
}
} catch (UnknownTermException e) {
TermValueException ex = new TermValueException();
ex.setAttributeLabel(e.getAttribute().getLabel().getValue());
ex.setCode(e.getCode());
throw e;
}
}
}
use of com.runwaysdk.dataaccess.MdBusinessDAOIF in project geoprism-registry by terraframe.
the class GeoObjectImporter method setClassificationValue.
protected void setClassificationValue(ServerGeoObjectIF entity, AttributeType attributeType, String attributeName, Object value, Date startDate, Date endDate) {
if (!this.configuration.isExclusion(attributeName, value.toString())) {
try {
ServerGeoObjectType type = this.configuration.getType();
MdBusinessDAOIF mdBusiness = type.getMdBusinessDAO();
MdAttributeClassificationDAOIF mdAttribute = (MdAttributeClassificationDAOIF) mdBusiness.definesAttribute(attributeName);
if (mdAttribute == null && type.getSuperType() != null) {
mdAttribute = (MdAttributeClassificationDAOIF) type.getSuperType().getMdBusinessDAO().definesAttribute(attributeName);
}
VertexObject classifier = AbstractClassification.findMatchingClassification(value.toString().trim(), mdAttribute);
if (classifier == null) {
throw new UnknownTermException(value.toString().trim(), attributeType);
// Term rootClassification = ( (AttributeClassificationType) attributeType ).getRootTerm();
//
// TermReferenceProblem trp = new TermReferenceProblem(value.toString(), rootClassification.getCode(), mdAttribute.getOid(), attributeName, attributeType.getLabel().getValue());
// trp.addAffectedRowNumber(this.progressListener.getWorkProgress() + 1);
// trp.setHistoryId(this.configuration.getHistoryId());
//
// this.progressListener.addReferenceProblem(trp);
} else {
entity.setValue(attributeName, classifier.getOid(), startDate, endDate);
}
} catch (UnknownTermException e) {
TermValueException ex = new TermValueException();
ex.setAttributeLabel(e.getAttribute().getLabel().getValue());
ex.setCode(e.getCode());
throw e;
}
}
}
use of com.runwaysdk.dataaccess.MdBusinessDAOIF in project geoprism-registry by terraframe.
the class ListTypeExcelExporter method createMetadataSheet.
private void createMetadataSheet(Workbook workbook) {
Sheet sheet = workbook.createSheet(this.getSheetName(workbook, "masterlist.metadata"));
Locale locale = Session.getCurrentLocale();
MdBusinessDAOIF metadata = MdBusinessDAO.getMdBusinessDAO(ListType.CLASS);
int rowNumber = 0;
this.createRow(sheet, locale, metadata, rowNumber++, ListType.DISPLAYLABEL, this.list.getDisplayLabel().getValue());
this.createRow(sheet, locale, metadata, rowNumber++, ListType.CODE, this.list.getCode());
this.createRow(sheet, rowNumber++, LocalizationFacade.getFromBundles("masterlist.publishDate"), stripTime(this.version.getPublishDate()));
this.createRow(sheet, rowNumber++, LocalizationFacade.getFromBundles("masterlist.forDate"), stripTime(this.version.getForDate()));
this.createRow(sheet, locale, metadata, rowNumber++, ListType.DESCRIPTION, this.list.getDescription().getValue());
this.createRow(sheet, locale, metadata, rowNumber++, ListType.LISTORIGINATOR, this.list.getOrganization());
this.createRow(sheet, locale, metadata, rowNumber++, ListType.LISTLABEL, this.list.getListLabel().getValue());
this.createRow(sheet, locale, metadata, rowNumber++, ListType.LISTDESCRIPTION, this.list.getListDescription().getValue());
this.createRow(sheet, locale, metadata, rowNumber++, ListType.LISTPROCESS, this.list.getListProcess().getValue());
this.createRow(sheet, locale, metadata, rowNumber++, ListType.LISTPROGRESS, this.list.getListProgress());
this.createRow(sheet, locale, metadata, rowNumber++, ListType.LISTACCESSCONSTRAINTS, this.list.getListAccessConstraints().getValue());
this.createRow(sheet, locale, metadata, rowNumber++, ListType.LISTUSECONSTRAINTS, this.list.getListAcknowledgements().getValue());
this.createRow(sheet, locale, metadata, rowNumber++, ListType.LISTDISCLAIMER, this.list.getListDisclaimer().getValue());
rowNumber++;
this.createRow(sheet, locale, metadata, rowNumber++, ListType.LISTCONTACTNAME, this.list.getListContactName());
this.createRow(sheet, locale, metadata, rowNumber++, ListType.LISTORGANIZATION, this.list.getListOrganization());
this.createRow(sheet, locale, metadata, rowNumber++, ListType.LISTTELEPHONENUMBER, this.list.getListTelephoneNumber());
this.createRow(sheet, locale, metadata, rowNumber++, ListType.LISTEMAIL, this.list.getListEmail());
}
use of com.runwaysdk.dataaccess.MdBusinessDAOIF in project geoprism-registry by terraframe.
the class HierarchyExporter method exportHierarchyDefinition.
/**
* Exports the metadata for the hierarchies. If a
* file of the specified filename already exists then the file is overwritten.
*
* @param fileName
* The name of the xml file to create.
* @param schemaLocation
* The location of the schema
* @param _exportOnlyModifiedAttributes
* True if only modified attributes should be exported, false otherwise.
*/
@Request
public static void exportHierarchyDefinition(String fileName, String schemaLocation, boolean _exportOnlyModifiedAttributes) {
ExportMetadata exportMetadata = new ExportMetadata();
QueryFactory qf = new QueryFactory();
// Export the MdBusinesses that define the hierarchy attributes
BusinessDAOQuery uQ = qf.businessDAOQuery(Universal.CLASS);
BusinessDAOQuery mdbQ = qf.businessDAOQuery(MdBusiness.CLASS);
mdbQ.WHERE(mdbQ.aUUID(MdBusiness.OID).EQ(uQ.aReference(Universal.MDBUSINESS).aUUID(Universal.OID)));
OIterator<? extends BusinessDAOIF> mdbI = mdbQ.getIterator();
try {
while (mdbI.hasNext()) {
MdBusinessDAOIF mdBusiness = (MdBusinessDAOIF) mdbI.next();
System.out.println(mdBusiness.getType() + " " + mdBusiness.getTypeName());
exportMetadata.addCreateOrUpdate(mdBusiness);
}
} finally {
mdbI.close();
}
// Export the Universals
uQ = qf.businessDAOQuery(Universal.CLASS);
OIterator<? extends BusinessDAOIF> uQI = uQ.getIterator();
try {
while (uQI.hasNext()) {
BusinessDAOIF businessDAOIF = (BusinessDAOIF) uQI.next();
System.out.println(businessDAOIF.getType() + " " + businessDAOIF.getKey());
exportMetadata.addCreateOrUpdate(businessDAOIF);
}
} finally {
mdbI.close();
}
// Export the MdTermRelationships that involve universals
List<MdTermRelationshipDAOIF> universalRelList = getUniversalRelationships();
for (MdTermRelationshipDAOIF mdTermRelationshipDAOIF : universalRelList) {
System.out.println(mdTermRelationshipDAOIF.getType() + " " + mdTermRelationshipDAOIF.getKey());
exportMetadata.addCreateOrUpdate(mdTermRelationshipDAOIF);
}
// Export the instances of the relationships between the universals.
for (MdTermRelationshipDAOIF mdTermRelationshipDAOIF : universalRelList) {
RelationshipDAOQuery relQ = qf.relationshipDAOQuery(mdTermRelationshipDAOIF.definesType());
OIterator<RelationshipDAOIF> relI = relQ.getIterator();
try {
while (relI.hasNext()) {
RelationshipDAOIF relationshipDAOIF = relI.next();
exportMetadata.addCreateOrUpdate(relationshipDAOIF);
}
} finally {
relI.close();
}
}
List<MdTermRelationshipDAOIF> geoEntityRelList = getGeoEntityRelationships();
for (MdTermRelationshipDAOIF mdTermRelationshipDAOIF : geoEntityRelList) {
System.out.println(mdTermRelationshipDAOIF.getType() + " " + mdTermRelationshipDAOIF.getKey());
exportMetadata.addCreateOrUpdate(mdTermRelationshipDAOIF);
}
VersionExporter.export(fileName, schemaLocation, exportMetadata);
// FileInstanceExporter.export(fileName, schemaLocation, queries, _exportOnlyModifiedAttributes);
}
Aggregations