Color
into a HTML representation of this
* Color
.
diff --git a/fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/ChainedProperties.java b/fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/ChainedProperties.java
index 870741bf5..c0a7d6ae0 100644
--- a/fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/ChainedProperties.java
+++ b/fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/ChainedProperties.java
@@ -76,11 +76,11 @@ public class ChainedProperties {
return null;
}
- public String getLastChainProperty(String key){
+ public String getLastChainProperty(String key) {
if (0 == chain.size()) {
return null;
}
- Object obj[] = (Object[]) chain.get(chain.size()-1);
+ Object obj[] = (Object[]) chain.get(chain.size() - 1);
HashMap prop = (HashMap) obj[1];
return (String) prop.get(key);
}
@@ -217,4 +217,31 @@ public class ChainedProperties {
return null;
}
+ /**
+ * 获取当前处理的标签
+ *
+ * @return 标签名
+ */
+ public String getLastTag() {
+ if (chain.size() == 0) {
+ return null;
+ }
+ Object obj[] = (Object[]) chain.get(chain.size() - 1);
+ return (String) obj[0];
+ }
+
+ /**
+ * 判断 LastChain 是否存在一对 Key - value
+ *
+ * @param key
+ * @param value
+ * @return
+ */
+ public boolean hasKvInLastChain(String key, String value) {
+ String actualValue = getLastChainProperty(key);
+ if (null == actualValue && null == value) {
+ return true;
+ }
+ return null == value ? actualValue.equals(value) : value.equals(actualValue);
+ }
}
diff --git a/fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/FactoryProperties.java b/fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/FactoryProperties.java
index 50f7c1716..db5f11f90 100644
--- a/fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/FactoryProperties.java
+++ b/fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/FactoryProperties.java
@@ -50,6 +50,7 @@
package com.fr.third.v2.lowagie.text.html.simpleparser;
+import com.fr.third.v2.lowagie.text.html.CSS;
import com.fr.third.v2.lowagie.text.html.BorderAttribute;
import com.fr.third.v2.lowagie.text.html.utils.BackgroundUtil;
import com.fr.third.v2.lowagie.text.html.utils.BorderUtils;
@@ -57,6 +58,7 @@ import java.awt.Color;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import java.util.List;
import java.util.Properties;
import java.util.StringTokenizer;
import com.fr.third.v2.lowagie.text.Chunk;
@@ -107,6 +109,7 @@ public class FactoryProperties {
}
return ck;
}
+
private static void setParagraphLeading(Paragraph p, String leading) {
if (leading == null) {
p.setLeading(0, 1.5f);
@@ -150,18 +153,10 @@ public class FactoryProperties {
if (props.hasProperty("noexist-attrid")) {
p.setAttribute("noexist-attrid", props.getProperty("noexist-attrid"));
}
- for(String margin : HtmlConstants.MARGIN){
- if(props.hasPropertyInChain("div", margin)){
- String ss = props.getPropertyFromChain("div", margin);
- p.setAttribute(margin, ss);
- }
- }
- for(String padding : HtmlConstants.PADDING){
- if(props.hasPropertyInChain("div", padding)){
- String ss = props.getPropertyFromChain("div", padding);
- p.setAttribute(padding, ss);
- }
- }
+
+ parseAlignAttr(p, props);
+ parseMarginAttr(p, props);
+ parsePaddingAttr(p, props);
String lastBlockTag = props.getLastBlockTag();
//这里解析的背景属性不能是table标签的
@@ -179,7 +174,7 @@ public class FactoryProperties {
p.setHyphenation(getHyphenation(props));
setParagraphLeading(p, props.getProperty("leading"));
- value = props.getProperty("before");
+ String value = props.getProperty("before");
if (value != null) {
try {
p.setSpacingBefore(Float.parseFloat(value));
@@ -202,6 +197,76 @@ public class FactoryProperties {
}
}
+ /**
+ * 解析align属性
+ *
+ * @param p
+ * @param props
+ */
+ private static void parseAlignAttr(Paragraph p, ChainedProperties props) {
+ String[] keys = new String[]{Markup.CSS_KEY_ALIGN, Markup.CSS_KEY_TEXTALIGN};
+ for (String key : keys) {
+ String value = props.getPropertyFromChain("div", key);
+ if (null == value) {
+ continue;
+ }
+ if (value.equalsIgnoreCase("center"))
+ p.setAlignment(Element.ALIGN_CENTER);
+ else if (value.equalsIgnoreCase("right"))
+ p.setAlignment(Element.ALIGN_RIGHT);
+ else if (value.equalsIgnoreCase("left"))
+ p.setAlignment(Element.ALIGN_LEFT);
+ else if (value.equalsIgnoreCase("justify"))
+ p.setAlignment(Element.ALIGN_JUSTIFIED);
+ }
+ }
+
+ /**
+ * 解析margin属性
+ *
+ * @param p
+ * @param props
+ */
+ private static void parseMarginAttr(Paragraph p, ChainedProperties props) {
+ if (props.hasPropertyInChain("div", Markup.CSS_KEY_MARGIN)) {
+ ListScheduler
.
*/
diff --git a/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/Trigger.java b/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/Trigger.java
index b64ed0bc4..7d630c118 100644
--- a/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/Trigger.java
+++ b/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/Trigger.java
@@ -127,6 +127,10 @@ public interface Trigger extends Serializable, Cloneable, ComparableTriggerKey
with the given name and default group to
* identify the Trigger.
diff --git a/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/core/QuartzScheduler.java b/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/core/QuartzScheduler.java
index 7914ef664..048c2d709 100644
--- a/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/core/QuartzScheduler.java
+++ b/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/core/QuartzScheduler.java
@@ -860,6 +860,10 @@ public class QuartzScheduler implements RemotableQuartzScheduler {
return ft;
}
+ public void changeAppointId(String oldId, String newId) {
+ resources.getJobStore().changeAppointId(oldId, newId);
+ }
+
/**
*
* Schedule the given {@link Trigger}
with the
diff --git a/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/RemoteMBeanScheduler.java b/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/RemoteMBeanScheduler.java
index 01910855e..1f615f644 100644
--- a/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/RemoteMBeanScheduler.java
+++ b/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/RemoteMBeanScheduler.java
@@ -165,6 +165,11 @@ public abstract class RemoteMBeanScheduler implements Scheduler {
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
+ @Override
+ public void changeAppointId(String oldId, String newId) {
+ // do nothing
+ }
+
/**
*
* Returns the name of the Scheduler
.
diff --git a/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/RemoteScheduler.java b/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/RemoteScheduler.java
index f8272b565..a803e085a 100644
--- a/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/RemoteScheduler.java
+++ b/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/RemoteScheduler.java
@@ -131,6 +131,11 @@ public class RemoteScheduler implements Scheduler {
return ex;
}
+ @Override
+ public void changeAppointId(String oldId, String newId) {
+ // do nothing
+ }
+
/**
*
* Returns the name of the Scheduler
.
diff --git a/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/StdScheduler.java b/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/StdScheduler.java
index e8ae613d4..0dc100946 100644
--- a/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/StdScheduler.java
+++ b/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/StdScheduler.java
@@ -89,6 +89,11 @@ public class StdScheduler implements Scheduler {
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
+ @Override
+ public void changeAppointId(String oldId, String newId) {
+ sched.changeAppointId(oldId, newId);
+ }
+
/**
*
* Returns the name of the Scheduler
.
diff --git a/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/StdSchedulerFactory.java b/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/StdSchedulerFactory.java
index 9e3b1f626..062ed8867 100644
--- a/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/StdSchedulerFactory.java
+++ b/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/StdSchedulerFactory.java
@@ -193,6 +193,8 @@ public class StdSchedulerFactory implements SchedulerFactory {
public static final String PROP_JOB_STORE_PREFIX = "com.fr.third.v2.org.quartz.jobStore";
+ public static final String PROP_JOB_STORE_CURRENT_ID = "com.fr.third.v2.org.quartz.jobStore.currentId";
+
public static final String PROP_JOB_STORE_LOCK_HANDLER_PREFIX = PROP_JOB_STORE_PREFIX + ".lockHandler";
public static final String PROP_JOB_STORE_LOCK_HANDLER_CLASS = PROP_JOB_STORE_LOCK_HANDLER_PREFIX + ".class";
@@ -860,8 +862,11 @@ public class StdSchedulerFactory implements SchedulerFactory {
throw initException;
}
+ String currentId = cfg.getStringProperty(PROP_JOB_STORE_CURRENT_ID);
+
try {
js = (JobStore) loadHelper.loadClass(jsClass).newInstance();
+ js.setCurrentId(currentId);
} catch (Exception e) {
initException = new SchedulerException("JobStore class '" + jsClass
+ "' could not be instantiated.", e);
diff --git a/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/jdbcjobstore/Constants.java b/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/jdbcjobstore/Constants.java
index 60290765c..252600ce7 100644
--- a/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/jdbcjobstore/Constants.java
+++ b/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/jdbcjobstore/Constants.java
@@ -105,6 +105,8 @@ public interface Constants {
String ALIAS_COL_NEXT_FIRE_TIME = "ALIAS_NXT_FR_TM";
+ String COL_APPOINT_ID= "APPOINT_ID";
+
// TABLE_SIMPLE_TRIGGERS columns names
String COL_REPEAT_COUNT = "REPEAT_COUNT";
diff --git a/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/jdbcjobstore/DriverDelegate.java b/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/jdbcjobstore/DriverDelegate.java
index f95dbfb89..d449b2428 100644
--- a/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/jdbcjobstore/DriverDelegate.java
+++ b/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/jdbcjobstore/DriverDelegate.java
@@ -99,6 +99,10 @@ public interface DriverDelegate {
String newState, String oldState1, String oldState2)
throws SQLException;
+ int updateTriggerStatesFromOtherStates(Connection conn, String newState, String oldState1, String oldState2, String oldState3) throws SQLException;
+
+ int updateTriggerAppointId(Connection conn, String oldId, String newId) throws SQLException;
+
/**
*
* Get the names of all of the triggers that have misfired - according to
@@ -968,6 +972,8 @@ public interface DriverDelegate {
public List
* Insert a fired trigger.
diff --git a/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/jdbcjobstore/JobStoreSupport.java b/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/jdbcjobstore/JobStoreSupport.java
index 4f3a3d6b0..a6e451966 100644
--- a/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/jdbcjobstore/JobStoreSupport.java
+++ b/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/jdbcjobstore/JobStoreSupport.java
@@ -159,6 +159,8 @@ public abstract class JobStoreSupport implements JobStore, Constants {
private volatile boolean schedulerRunning = false;
private volatile boolean shutdown = false;
+ private volatile String currentId;
+
/*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
@@ -167,6 +169,32 @@ public abstract class JobStoreSupport implements JobStore, Constants {
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
+ @Override
+ public void setCurrentId(String currentId) {
+ this.currentId = currentId;
+ }
+
+ @Override
+ public void changeAppointId(final String oldId, final String newId) {
+
+ try {
+ executeInNonManagedTXLock(
+ LOCK_TRIGGER_ACCESS,
+ new VoidTransactionCallback() {
+ public void executeVoid(Connection conn) throws JobPersistenceException {
+ try {
+ int rows = getDelegate().updateTriggerAppointId(conn, oldId, newId);
+ getLog().info("update " + rows + " triggers appointId from " + oldId + " to " + newId);
+ } catch (SQLException e) {
+ throw new JobPersistenceException("Couldn't update appointId: " + e.getMessage(), e);
+ }
+ }
+ }, null);
+ } catch (JobPersistenceException e) {
+ getLog().error(e.getMessage());
+ }
+ }
+
/**
*
* Set the name of the
* Get the names of all of the triggers that have misfired.
@@ -1088,6 +1119,7 @@ public class StdJDBCDelegate implements DriverDelegate, StdJDBCConstants {
ps.setInt(13, trigger.getMisfireInstruction());
setBytes(ps, 14, baos);
ps.setInt(15, trigger.getPriority());
+ ps.setString(16, trigger.getAppointId());
insertResult = ps.executeUpdate();
@@ -2624,6 +2656,40 @@ public class StdJDBCDelegate implements DriverDelegate, StdJDBCConstants {
}
}
+ public List
* Insert a fired trigger.
diff --git a/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/jdbcjobstore/oracle/OracleDelegate.java b/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/jdbcjobstore/oracle/OracleDelegate.java
index 048f315a5..dfcbef3fc 100644
--- a/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/jdbcjobstore/oracle/OracleDelegate.java
+++ b/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/jdbcjobstore/oracle/OracleDelegate.java
@@ -318,6 +318,7 @@ public class OracleDelegate extends StdJDBCDelegate {
ps.setInt(13, trigger.getMisfireInstruction());
ps.setBinaryStream(14, null, 0);
ps.setInt(15, trigger.getPriority());
+ ps.setString(16, trigger.getAppointId());
insertResult = ps.executeUpdate();
diff --git a/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/triggers/AbstractTrigger.java b/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/triggers/AbstractTrigger.java
index 1305a8412..572475908 100644
--- a/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/triggers/AbstractTrigger.java
+++ b/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/triggers/AbstractTrigger.java
@@ -75,6 +75,8 @@ public abstract class AbstractTrigger
* Called by the QuartzScheduler before the DataSource
that should be used for
@@ -854,14 +882,14 @@ public abstract class JobStoreSupport implements JobStore, Constants {
try {
// update inconsistent job states
int rows = getDelegate().updateTriggerStatesFromOtherStates(conn,
- STATE_WAITING, STATE_ACQUIRED, STATE_BLOCKED);
+ STATE_WAITING, STATE_ACQUIRED, STATE_BLOCKED, STATE_ERROR);
rows += getDelegate().updateTriggerStatesFromOtherStates(conn,
STATE_PAUSED, STATE_PAUSED_BLOCKED, STATE_PAUSED_BLOCKED);
getLog().info(
"Freed " + rows
- + " triggers from 'acquired' / 'blocked' state.");
+ + " triggers from 'acquired' / 'blocked' / 'error' state.");
// clean up misfired jobs
recoverMisfiredJobs(conn, true);
@@ -2780,6 +2808,17 @@ public abstract class JobStoreSupport implements JobStore, Constants {
});
}
+ private void mergeKeys(ListJobStore
is
diff --git a/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/spi/JobStore.java b/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/spi/JobStore.java
index fe4026ce8..570199d29 100644
--- a/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/spi/JobStore.java
+++ b/fine-quartz/src/main/java/com/fr/third/v2/org/quartz/spi/JobStore.java
@@ -68,6 +68,19 @@ public interface JobStore {
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
+ /**
+ * 设置当前节点id
+ */
+ void setCurrentId(String currentId);
+
+ /**
+ * 切换指定节点id
+ * @param oldId 旧id
+ * @param newId 新id
+ */
+ void changeAppointId(String oldId, String newId);
+
+
/**
* Called by the QuartzScheduler before the JobStore
is
* used, in order to give the it a chance to initialize.
diff --git a/fine-spring/pom.xml b/fine-spring/pom.xml
index 8c03f0952..5fa28d6c9 100644
--- a/fine-spring/pom.xml
+++ b/fine-spring/pom.xml
@@ -65,7 +65,7 @@