Opened 13 years ago

Last modified 12 years ago

#782 new task

Administration / add old GAST sync option

Reported by: fxp Owned by: geonetwork-devel@…
Priority: major Milestone: v2.10.0 RC0
Component: General Version:
Keywords: Cc:

Description

Related to r8643:

public void sync(Dbms dbms) throws Exception
	{
		SettingManager sm = new SettingManager(dbms, new ProviderManager());
		Element settings = Xml.transform(sm.get("system", -1), Config.getConfig().getWebapp()+ "/" + Geonet.Path.STYLESHEETS+ "/xml/config.xsl");
		try
		{
			List list = dbms.select("SELECT * FROM Metadata WHERE isTemplate='n' and isHarvested='n'").getChildren();
			dbms.commit();

			String siteURL = Lib.site.getSiteURL(dbms);

			for(int i=0; i<list.size(); i++)
			{
				Element record = (Element) list.get(i);

				String id     = record.getChildText("id");
				String schema = record.getChildText("schemaid");
				String data   = record.getChildText("data");
				String uuid   = record.getChildText("uuid");
				String date   = record.getChildText("createdate");

				Element md = updateFixedInfo(id, Xml.loadString(data, false),
													  uuid, date, schema, siteURL, settings, sm);

				_xmlSerializer.update(dbms, id, md, date, true, _session);
				dbms.commit();
			}
		}
		catch(Exception e)
		{
			dbms.abort();
			throw e;
		}
	}

Change History (1)

comment:1 by ianwallen, 12 years ago

Milestone: v2.7.0v2.9.0
Note: See TracTickets for help on using tickets.